package com.wzq.controller;

import com.wzq.entity.Resume;
import com.wzq.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

/**
 * @author wzq.Jolin
 * @company none
 * @create 2020-07-14 19:28
 */
@Controller
@RequestMapping("/resume")
public class ResumeController {

    @Autowired
    private ResumeService resumeService;

    @RequestMapping("/queryAll")
    public @ResponseBody  List< Resume > queryAll() {
        List<Resume> list = resumeService.queryAll();
        return list;
    }

    @RequestMapping("/save")
    public @ResponseBody Boolean saveResume(@RequestBody Resume r) {
        if(resumeService.saveResume(r)==null){
            return false;
        }
        return true;
    }

    @RequestMapping("/delete")
    public @ResponseBody Boolean deleteResume(@RequestBody Resume r) {
        resumeService.deleteResume(r.getId());
        return true;
    }
}
